<template>
	<view class="menu_bar">

		<view class="menu_list" v-for="(item, index) in menuList" :key="index" hover-stop-propagation="true" @click="
							index == 0 ? morePolicy()
							:index == 1 ?publish()
							:index == 2 ?moreVideo()
							:index == 3 ?search_shenqing()
							:''
						">
			<view style="width: 135rpx;height: 135rpx;;background-color: #016fb8;border-radius: 50%;margin-left: 22%;">
				<image class="menu_icon" :src="item.icon"></image>
			</view>
			<view class="icon" hover-stop-propagation="true">
				<text>{{item.name}}</text>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		useStore
	} from "vuex";
	import env from '@/utils/env';
	import * as artical from "@/api/article";
	import * as video from "@/api/video";
	import * as myLive from "@/api/zhibo.js"
	import {
		codeList
	} from "@/utils/code";
	import {
		defineComponent
	} from "vue";
	export default {
		data() {
			return {
				title: '',
				imgList: [{
						id: '0',
						image: 'http://113.142.144.25:9301/statics/appimg/bannerApp1.jpg'
					},
					{
						id: '1',
						image: 'http://113.142.144.25:9301/statics/appimg/bannerApp2.jpg'
					},
					{
						id: '2',
						image: 'http://113.142.144.25:9301/statics/appimg/bannerApp3.jpg'
					},
				],
				menuList: [{
						name: '科技成果登记',
						icon: 'http://113.142.144.25:8082/static/img/service3.32c9bf3c.png'
					},
					{
						name: '科学技术奖申报',
						icon: 'http://113.142.144.25:8082/static/img/service6.460bb50d.png'
					},
					{
						name: '技术合同服务',
						icon: 'http://113.142.144.25:8082/static/img/service5.73ac5a91.png'
					},
					{
						name: '可转化成果发布',
						icon: 'http://113.142.144.25:8082/static/img/service2.0cd7751e.png'
					},
				],
				videoList: [{
					title: '',
					publishTime: ''
				}],
				noticeList: [{
					title: ''
				}],
				policyList: [{
					title: '',
					publishTime: ''
				}],
				liveList: [{
					title: '',
					publishTime: ''
				}],
				noData: '加载中。。。',
				currentIndex: 0,
				zhiboList: [],
			}
		},
		onLoad() {
			uni.showLoading({
				title: "加载中"
			})
			this.getNoticeFour();
			// this.getVideo();
		},
		methods: {
			reLoad() {
				uni.showLoading({
					title: "加载中。。。"
				})
				this.getNoticeFour();
			},
			morePolicy() {
				uni.showModal({
					title: '温馨提示',
					content: '请前往电脑端完成登记，地址：https://www.js-r.com/register/frontend/web/index.php',
					confirmText: "我知道了", // 确认按钮的文字  
					showCancel: false, // 是否显示取消按钮，默认为 true
					confirmColor: '#007aff',
					success: (res) => {
						if (res.confirm) {
							// console.log('comfirm') //点击确定之后执行的代码
						} else {
							// console.log('cancel') //点击取消之后执行的代码
						}
					}
				})
			},
			moreNotice() {
				uni.navigateTo({
					url: '/subpages/pages/notice/notice_list'
				})
			},
			moreVideo() {
				uni.showModal({
					title: '温馨提示',
					content: '请前往电脑端完成填报，地址：https://ctmht.chinatorch.org.cn/admin/login',
					confirmText: "我知道了", // 确认按钮的文字  
					showCancel: false, // 是否显示取消按钮，默认为 true
					confirmColor: '#007aff',
					success: (res) => {
						if (res.confirm) {
							// console.log('comfirm') //点击确定之后执行的代码
						} else {
							// console.log('cancel') //点击取消之后执行的代码
						}
					}
				})
			},
			publish() {
				uni.showModal({
					title: '温馨提示',
					content: '请前往电脑端完成申报，地址：https://cgjl.sstrc.com/login.aspx',
					confirmText: "我知道了", // 确认按钮的文字  
					showCancel: false, // 是否显示取消按钮，默认为 true
					confirmColor: '#007aff',
					success: (res) => {
						if (res.confirm) {
							// console.log('comfirm') //点击确定之后执行的代码
						} else {
							// console.log('cancel') //点击取消之后执行的代码
						}
					}
				})
			},
			// exchange(){
			// 	uni.navigateTo({
			// 		url:'/pages/achievement/achievement_publish'
			// 	})
			// },
			search_shenqing() {
				uni.navigateTo({
					url:'/subpages/pages/cgzh/cgzhdj'
				})
			},
			getNoticeFour() {
				// artical.getArticle(codeList.TZGG).then((res) => {
				// 	this.noticeList = res.rows;
				// });
				// artical.getArticleFive(codeList.KJZC).then((res) => {
				// 	this.policyList = res.rows;
				// });
				artical.getArticle({
					pageNum: 1,
					pageSize: 10,
				}).then((res) => {
					this.noticeList = res.rows
				})
				video.getVideoFour().then((res) => {
					this.videoList = []
					res.rows.forEach(v => {
						v.coverImage = `${env.imgUrl}` + v.coverImage
						this.videoList.push(v)
					})
				});
				myLive.listLive().then((res) => {
					this.liveList = res.rows
				});
				if (this.noticeList.length == 0) {
					this.noData = '暂无数据，点击重试！'
				}
				uni.hideLoading({});
			},
			// getVideo(){
			// 	video.getVideoFour().then((res) => {
			// 		this.videoList = res.rows
			// 	});
			// },
			swiperChange() {

			},
			videoDetail(item) {
				uni.navigateTo({
					url: '/subpages/pages/detail/video_detail?id=' + item.id
				})
			},
			zhiboCenter() {
				uni.navigateTo({
					url: '/subpages/pages/zhiboCenter/zhiboList'
				})
			},

			//科技资源
			talentCenter() {
				uni.navigateTo({
					url: '/subpages/pages/resource/member/techPersonList'
				})
			},
			kjcgCenter() {
				uni.navigateTo({
					url: '/subpages/pages/resource/kjcg/index'
				})
			},
			machineList() {
				uni.navigateTo({
					url: '/subpages/pages/resource/kyyq/index'
					// url:'/pages/machineCenter/machine_list?orderType='+'0'
				})
			},
			projectCenter() {
				// uni.navigateTo({
				// 	url:'/subpages/pages/resource/kyyq/index'
				// 	// url:'/pages/machineCenter/machine_list?orderType='+'0'
				// })
				uni.showToast({
					icon: 'error',
					title: '此库暂未开放！'
				})
			},
			companyCenter() {
				uni.navigateTo({
					url: '/subpages/pages/resource/kjqy/index'
				})
			},
			zoneCenter() {
				uni.navigateTo({
					url: '/subpages/pages/resource/zone/zone'
				})
			},
			achivementCenter() {
				uni.navigateTo({
					url: '/subpages/pages/achivement/achivement_list'
				})
			}

		}
	}
</script>

<style>
	.scv {
		width: 100%;
		height: 100%;
		margin: 0 auto;
		background: #e6e6e6;
	}

	.title_icon {
		width: 35rpx;
		height: 35rpx;
		margin-left: 4%;
		margin-top: 20rpx;
	}

	/* 轮播图 */
	.image-container {
		/* width: 750rpx; */
		margin: 20rpx 30rpx;
		height: 320rpx;
	}

	.item {
		position: relative;
	}

	.image {
		width: 100%;
		height: 300rpx;
		border-radius: 15rpx;
	}

	.notice_view {
		margin: 20rpx 30rpx;
		height: 80rpx;
		background-color: #fff;
		border-radius: 15rpx;
	}

	.policy_view {
		height: 190rpx;
		margin: 25rpx 30rpx;
		border-radius: 15rpx;
	}

	.menu_bar {
		height: 240rpx;
		width: 92%;
		background-color: #fff;
		margin: 25rpx 30rpx;
		border-radius: 15rpx;
	}

	.icon {
		margin: 20rpx auto;
		text-align: center;
	}

	.menu_icon {
		width: 55rpx;
		height: 59rpx;
		padding: 15rpx;
		margin-left: 5%;
		margin-top: 15%;
	}

	.menu_list {
		font-size: 25rpx;
		float: left;
		width: 35%;
		text-align: center;
		margin-left: 10%;
		margin-top: 10%;
	}

	.source_bar {
		height: 430rpx;
		width: 92%;
		background-color: #fff;
		margin: 25rpx 30rpx;
		border-radius: 15rpx;
	}

	.video_list {
		width: 92%;
		margin: 20rpx 30rpx;
		height: 700rpx;
		background-color: #fff;
		border-radius: 15rpx;
	}

	.notice_list {
		/* 		width: 88%; */
		margin: 20rpx 30rpx;
		height: 660rpx;
		background-color: #fff;
		border-radius: 15rpx;
	}

	.policy_item {
		padding: 20rpx;
	}

	.policy_title {
		display: -webkit-box;
		width: 650rpx;
		font-size: 25rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
	}

	.publicTime {
		float: left;
		font-size: 23rpx;
		color: #a1a1a1;
		margin-top: 5rpx;
	}

	.devideline {
		float: left;
		height: 0.3rpx;
		width: 100%;
		background-color: #eeeeee;
		margin-top: 15rpx;
		margin-bottom: 15rpx;
	}

	.jumpToPolicy {
		font-size: 26rpx;
		float: left;
		width: 90%;
		height: 70rpx;
		margin-top: 20rpx;
		background-color: #016fb8;
		margin-left: 5%;
	}

	.video_item {
		padding: 20rpx;
	}

	.video_img {
		height: 120rpx;
		width: 25%;
		float: left;
		border-radius: 10rpx;
	}

	.video_content {
		width: 70%;
		float: right;
		margin-left: 15rpx;
	}

	.video_title {
		display: -webkit-box;
		font-size: 30rpx;
		padding_top: 15rpx;
		white-space: nowrap;
		margin-top: 15rpx;
		font-size: 25rpx;
		overflow: hidden;
		margin-right: 20rpx;
		white-space: nowrap;
		text-overflow: ellipsis;
		-webkit-box-orient: vertical;
		/*排列方式*/
		-webkit-line-clamp: 1;
		/*显示文本行数(这里控制多少行隐藏)*/
	}

	.policy_new {
		display: -webkit-box;
		width: 70%;
		height: 100rpx;
		line-height: 40rpx;
		float: right;
		margin-top: 15rpx;
		margin-right: 20rpx;
		font-size: 28rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2; //显示几行
	}

	.notice_name {
		display: -webkit-box;
		width: 90%;
		margin-top: 20rpx;
		font-size: 28rpx;
		overflow: hidden;
		word-break: break-all;
		/* break-all(允许在单词内换行。) */
		text-overflow: ellipsis;
		/* 超出部分省略号 */
		display: -webkit-box;
		/** 对象作为伸缩盒子模型显示 **/
		-webkit-box-orient: vertical;
		/** 设置或检索伸缩盒对象的子元素的排列方式 **/
		-webkit-line-clamp: 1;
		/** 显示的行数 **/
	}
</style>